This repository was archived by the owner on Feb 18, 2025. It is now read-only.
Add option to increase specificity of class for styled components#1
Open
Add option to increase specificity of class for styled components#1
Conversation
This was referenced Oct 20, 2017
harrismd
reviewed
Oct 23, 2017
| export const useMinify = (state) => getOption(state, 'minify') | ||
| export const useCSSPreprocessor = (state) => getOption(state, 'preprocess', false) // EXPERIMENTAL | ||
| export const useTranspileTemplateLiterals = (state) => getOption(state, 'transpileTemplateLiterals') | ||
| export const useIncreaseSpecificityClass = state => getOption(state, 'specificityClass', null); |
Collaborator
There was a problem hiding this comment.
Usually these are called "namespace classes" (not to be confused with CSS namespaces which serve a different purpose). Perhaps that terminology would be more clear.
Collaborator
Author
|
Great name suggestion @harrismd! Fixed. |
harrismd
reviewed
Oct 23, 2017
| const namespaceClassOption = Array.isArray(namespaceClasses) ? | ||
| t.arrayExpression(namespaceClasses) | ||
| : t.stringLiteral(namespaceClass); | ||
| withConfigProps.push(t.objectProperty(t.identifier('namespaceClass'), namespaceClassOption)) |
Collaborator
There was a problem hiding this comment.
Is this supposed to be: t.identifier('namespaceClasses')
Collaborator
There was a problem hiding this comment.
I assume this is accessing the value in the config...
harrismd
approved these changes
Oct 23, 2017
Collaborator
harrismd
left a comment
There was a problem hiding this comment.
approved pending double-check of that one constant.
Collaborator
Author
|
@harrismd - Fixed. Apologies that was a bit of a work in progress when you saw it. Had to make some other changes due to how babel-types work. |
2915b8d to
cd97215
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR works with QuickBase/styled-components#3
It allows the specificity class to be set through a babel plugin configuration.
or for a list of classes
Results in classes to be pre-prended with the specificity class.
E.g.,